OpenStack Newton : How to use Ceilometer
2016/11/01 |
How to use the OpenStack Metering Service (Ceilometer).
This example is based on the environment like follows.
| +------------------+ | +------------------------+ | [ Control Node ] | | | [ Network Node ] | | Keystone |10.0.0.30 | 10.0.0.50| DHCP,L3,L2 Agent | | Glance |------------+------------| Metadata Agent | | Nova API |eth0 | eth0| Ceilometer Services | | Neutron Server | | | | +------------------+ | +------------------------+ eth0|10.0.0.51 +--------------------+ | [ Compute Node ] | | Nova Compute | | L2 Agent | | Ceilometer-Compute | +--------------------+ |
[1] | If you configured Ceilometer #1 section, Ceilometer #2 section, Ceilometer #3 section, the command shows results without errors like follows. (no data is shown yet) |
[root@dlp ~(keystone)]# ceilometer meter-list +------+------+------+-------------+---------+------------+ | Name | Type | Unit | Resource ID | User ID | Project ID | +------+------+------+-------------+---------+------------+ +------+------+------+-------------+---------+------------+ |
[2] | Configure to enable monitoring Compute Service (Nova). |
# add into [DEFAULT] section instance_usage_audit = True instance_usage_audit_period = hour notify_on_state_change = vm_and_task_state # add to the end [oslo_messaging_notifications] driver = messagingv2
[root@node01 ~]#
systemctl restart openstack-nova-compute
# after configuring, data is loged like follows when an instance is used and so on [root@dlp ~(keystone)]# ceilometer meter-list +---------------------+-------+----------+------------------------------+----------------------------------+----------------+ | Name | Type | Unit | Resource ID | User ID | Project ID | +---------------------+-------+----------+------------------------------+----------------------------------+----------------+ | disk.ephemeral.size | gauge | GB | cb33e162-391c-42db-90e7-7825 | 185dcfff08524c52b92cac84d52a92d2 | c615465cefc... | | disk.root.size | gauge | GB | cb33e162-391c-42db-90e7-7825 | 185dcfff08524c52b92cac84d52a92d2 | c615465cefc... | | image | gauge | image | 4c8ee57d-c9ba-4f7f-9bd1-d19a | None | c615465cefc... | | image.size | gauge | B | 4c8ee57d-c9ba-4f7f-9bd1-d19a | None | c615465cefc... | | instance | gauge | instance | cb33e162-391c-42db-90e7-7825 | 185dcfff08524c52b92cac84d52a92d2 | c615465cefc... | | ip.floating | gauge | ip | fe1782ca-7e4e-4dee-873a-7127 | None | c615465cefc... | | memory | gauge | MB | cb33e162-391c-42db-90e7-7825 | 185dcfff08524c52b92cac84d52a92d2 | c615465cefc... | | vcpus | gauge | vcpu | cb33e162-391c-42db-90e7-7825 | 185dcfff08524c52b92cac84d52a92d2 | c615465cefc... | +---------------------+-------+----------+------------------------------+----------------------------------+----------------+ |
[3] | Configure to enable monitoring Image Service (Glance). |
# add into [DEFAULT] section
rpc_backend = rabbit
# add to the end [oslo_messaging_notifications] driver = messagingv2 [oslo_messaging_rabbit] rabbit_host = 10.0.0.30 rabbit_port = 5672 rabbit_userid = openstack rabbit_password = password
[root@dlp ~(keystone)]#
vi /etc/glance/glance-registry.conf # add into [DEFAULT] section
rpc_backend = rabbit
# add to the end [oslo_messaging_notifications] driver = messagingv2 [oslo_messaging_rabbit] rabbit_host = 10.0.0.30 rabbit_port = 5672 rabbit_userid = openstack rabbit_password = password
[root@dlp ~(keystone)]#
systemctl restart openstack-glance-api openstack-glance-registry
# after configuring, data is loged like follows when an image is created and so on [root@dlp ~(keystone)]# ceilometer meter-list +---------------------+-------+----------+------------------------------+----------------------------------+----------------+ | Name | Type | Unit | Resource ID | User ID | Project ID | +---------------------+-------+----------+------------------------------+----------------------------------+----------------+ | disk.ephemeral.size | gauge | GB | cb33e162-391c-42db-90e7-7... | 185dcfff08524c52b92cac84d52a92d2 | c615465cefc... | | disk.root.size | gauge | GB | cb33e162-391c-42db-90e7-7... | 185dcfff08524c52b92cac84d52a92d2 | c615465cefc... | | image | gauge | image | 4c8ee57d-c9ba-4f7f-9bd1-d... | None | c615465cefc... | | image.size | gauge | B | 4c8ee57d-c9ba-4f7f-9bd1-d... | None | c615465cefc... | | instance | gauge | instance | cb33e162-391c-42db-90e7-7... | 185dcfff08524c52b92cac84d52a92d2 | c615465cefc... | | ip.floating | gauge | ip | fe1782ca-7e4e-4dee-873a-7... | None | c615465cefc... | | memory | gauge | MB | cb33e162-391c-42db-90e7-7... | 185dcfff08524c52b92cac84d52a92d2 | c615465cefc... | | vcpus | gauge | vcpu | cb33e162-391c-42db-90e7-7... | 185dcfff08524c52b92cac84d52a92d2 | c615465cefc... | +---------------------+-------+----------+------------------------------+----------------------------------+----------------+ # create an image [root@dlp ~(keystone)]# glance image-create --name "CentOS71" --file /var/kvm/images/centos7.img --disk-format qcow2 --container-format bare --visibility public [root@dlp ~(keystone)]# ceilometer meter-list +---------------------+-------+----------+------------------------------+----------------------------------+----------------+ | disk.ephemeral.size | gauge | GB | cb33e162-391c-42db-90e7-7... | 185dcfff08524c52b92cac84d52a92d2 | c615465cefc... | | disk.root.size | gauge | GB | cb33e162-391c-42db-90e7-7... | 185dcfff08524c52b92cac84d52a92d2 | c615465cefc... | | image | gauge | image | 4c8ee57d-c9ba-4f7f-9bd1-d... | None | c615465cefc... | | image.size | gauge | B | 4c8ee57d-c9ba-4f7f-9bd1-d... | None | c615465cefc... | | image.size | gauge | B | e6e04a4d-f13f-419a-8d99-0... | None | c615465cefc... | | instance | gauge | instance | cb33e162-391c-42db-90e7-7... | 185dcfff08524c52b92cac84d52a92d2 | c615465cefc... | | ip.floating | gauge | ip | fe1782ca-7e4e-4dee-873a-7... | None | c615465cefc... | | memory | gauge | MB | cb33e162-391c-42db-90e7-7... | 185dcfff08524c52b92cac84d52a92d2 | c615465cefc... | | vcpus | gauge | vcpu | cb33e162-391c-42db-90e7-7... | 185dcfff08524c52b92cac84d52a92d2 | c615465cefc... | +---------------------+-------+----------+------------------------------+----------------------------------+----------------+ # data is loged |
[4] | Configure to enable monitoring Block Storage (Cinder). |
# add to the end [oslo_messaging_notifications] driver = messagingv2 # on Control Node [root@dlp ~(keystone)]# systemctl restart openstack-cinder-api openstack-cinder-scheduler # on Network Node [root@network ~]# systemctl restart openstack-cinder-volume
# after configuring, data is loged like follows when a volume is created and so on [root@dlp ~(keystone)]# ceilometer meter-list +---------------------+-------+----------+------------------------------+----------------------------------+----------------+ | disk.ephemeral.size | gauge | GB | cb33e162-391c-42db-90e7-7... | 185dcfff08524c52b92cac84d52a92d2 | c615465cefc... | | disk.root.size | gauge | GB | cb33e162-391c-42db-90e7-7... | 185dcfff08524c52b92cac84d52a92d2 | c615465cefc... | | image | gauge | image | 4c8ee57d-c9ba-4f7f-9bd1-d... | None | c615465cefc... | | image.size | gauge | B | 4c8ee57d-c9ba-4f7f-9bd1-d... | None | c615465cefc... | | image.size | gauge | B | e6e04a4d-f13f-419a-8d99-0... | None | c615465cefc... | | instance | gauge | instance | cb33e162-391c-42db-90e7-7... | 185dcfff08524c52b92cac84d52a92d2 | c615465cefc... | | ip.floating | gauge | ip | fe1782ca-7e4e-4dee-873a-7... | None | c615465cefc... | | memory | gauge | MB | cb33e162-391c-42db-90e7-7... | 185dcfff08524c52b92cac84d52a92d2 | c615465cefc... | | vcpus | gauge | vcpu | cb33e162-391c-42db-90e7-7... | 185dcfff08524c52b92cac84d52a92d2 | c615465cefc... | +---------------------+-------+----------+------------------------------+----------------------------------+----------------+ # create a volume [root@dlp ~(keystone)]# openstack volume create --size 2 disk02 [root@dlp ~(keystone)]# ceilometer meter-list +---------------------+-------+----------+------------------------------+----------------------------------+----------------+ | Name | Type | Unit | Resource ID | User ID | Project ID | +---------------------+-------+----------+------------------------------+----------------------------------+----------------+ | disk.ephemeral.size | gauge | GB | cb33e162-391c-42db-90e7-7... | 185dcfff08524c52b92cac84d52a92d2 | c615465cefc... | | disk.root.size | gauge | GB | cb33e162-391c-42db-90e7-7... | 185dcfff08524c52b92cac84d52a92d2 | c615465cefc... | | image | gauge | image | 4c8ee57d-c9ba-4f7f-9bd1-d... | None | c615465cefc... | | image | gauge | image | e6e04a4d-f13f-419a-8d99-0... | None | c615465cefc... | | image.size | gauge | B | 4c8ee57d-c9ba-4f7f-9bd1-d... | None | c615465cefc... | | image.size | gauge | B | e6e04a4d-f13f-419a-8d99-0... | None | c615465cefc... | | instance | gauge | instance | cb33e162-391c-42db-90e7-7... | 185dcfff08524c52b92cac84d52a92d2 | c615465cefc... | | ip.floating | gauge | ip | fe1782ca-7e4e-4dee-873a-7... | None | c615465cefc... | | memory | gauge | MB | cb33e162-391c-42db-90e7-7... | 185dcfff08524c52b92cac84d52a92d2 | c615465cefc... | | vcpus | gauge | vcpu | cb33e162-391c-42db-90e7-7... | 185dcfff08524c52b92cac84d52a92d2 | c615465cefc... | | volume.size | gauge | GB | f1a0e500-33a7-4afb-afec-1... | 185dcfff08524c52b92cac84d52a92d2 | c615465cefc... | +---------------------+-------+----------+------------------------------+----------------------------------+----------------+ |